home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / Anwendun / 7UP_PD / TEXTMARK.C < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-17  |  2.5 KB  |  117 lines

  1. /* markieren und anspringen von Textstellen */
  2. /*****************************************************************************
  3. *
  4. *                                              7UP
  5. *                            Modul: TEXTMARK.C
  6. *                           (c) by TheoSoft '90
  7. *
  8. *****************************************************************************/
  9. #include <portab.h>
  10. #include <stdio.h>
  11. #include <aes.h>
  12.  
  13. #include "windows.h"
  14. #include "forms.h"
  15. #include "7up.h"
  16.  
  17. #include "language.h"
  18.  
  19. textmarker(WINDOW *wp, OBJECT *tree, int item, int kstate, int key)
  20. {
  21.     int i,k,exit_obj;
  22.     char string[19];
  23.     
  24.     static long mark[5][5]=
  25.     {
  26.         0,0,0,0,0,
  27.         0,0,0,0,0,
  28.         0,0,0,0,0,
  29.         0,0,0,0,0,
  30.         0,0,0,0,0
  31.     };
  32.  
  33.     switch(item)
  34.     {
  35.         case SEARSMRK:
  36.             for(i=MARK1; i<=MARK5; i++)
  37.             {
  38.                 if(tree[i].ob_type==G_USERDEF)
  39.                 {
  40.                     tree[i].ob_flags|=TOUCHEXIT;
  41.                     tree[i].ob_state&=~DISABLED;
  42.                     k=i/2-1;
  43.                     if(mark[k][0] ||
  44.                         mark[k][1] ||
  45.                         mark[k][2] ||
  46.                         mark[k][3])
  47.                     {
  48.                         tree[i].ob_state|=SELECTED;
  49.                     }
  50.                     else
  51.                     {
  52.                         tree[i].ob_state&=~SELECTED;
  53.                     }
  54.                 }
  55.             }
  56.             form_write(tree,MARKTITL,MARKE_SETZEN,FALSE);
  57.             tree[MARKTITL].ob_width=strlen(MARKE_SETZEN)*8;
  58.             exit_obj=form_exhndl(tree,0,0);
  59.             if(exit_obj!=MARKABBR)
  60.             {
  61.                 k=exit_obj/2-1;
  62.                 mark[k][0]=wp->row+wp->hfirst/wp->hscroll;
  63.                 mark[k][1]=wp->col+wp->wfirst/wp->wscroll;
  64.                 mark[k][2]=(long)wp->cstr;
  65.                 mark[k][3]=(long)wp->cstr->string;
  66.                 mark[k][4]=(long)wp;
  67.                 form_read(tree,exit_obj+1,string);
  68.                 if(!*string) /* nur ausfüllen, wenn nichts drin */
  69.                 {
  70.                     strncpy(string,&wp->cstr->string[wp->col+wp->wfirst/wp->wscroll],18);
  71.                     string[18]=0;
  72.                     form_write(tree,exit_obj+1,string,FALSE);
  73.                 }
  74.             }
  75.             break;
  76.         case SEARGMRK:
  77.             for(i=MARK1; i<=MARK5; i++)
  78.             {
  79.                 if(tree[i].ob_type==G_USERDEF)
  80.                 {
  81.                     k=i/2-1;
  82.                     if(mark[k][0] ||
  83.                         mark[k][1] ||
  84.                         mark[k][2] ||
  85.                         mark[k][3])
  86.                     {
  87.                         tree[i].ob_state=NORMAL;
  88.                     }
  89.                     else
  90.                     {
  91.                         tree[i].ob_state|=DISABLED;
  92.                         tree[i].ob_flags&=~TOUCHEXIT;
  93.                     }
  94.                 }
  95.             }
  96.             form_write(tree,MARKTITL,SUCHE_MARKE,FALSE);
  97.             tree[MARKTITL].ob_width=strlen(SUCHE_MARKE)*8;
  98.             exit_obj=form_exhndl(tree,0,0);
  99.             if(exit_obj!=MARKABBR)
  100.             {
  101.                 k=exit_obj/2-1;
  102.                 gotomark(wp,mark[k]);
  103.             }
  104.             break;
  105.         default:
  106.             if(key>=0 && key<=4)
  107.                 if(mark[key][0] ||
  108.                     mark[key][1] ||
  109.                     mark[key][2] ||
  110.                     mark[key][3])
  111.                 {
  112.                     gotomark(wp,mark[key]);
  113.                 }
  114.             break;
  115.     }
  116. }
  117.